package com.framework.minio;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author JamesYao
 */
@Data
@Component
public class MinioClientConfig {

    @Autowired
    private MinioProperties properties;

    @Bean
    public MinioClient minioClient(){
        return  MinioClient.builder()
                .endpoint(properties.getEndpoint())
                .credentials(properties.getAccessKey(),properties.getSecretKey())
                .build();
    }
}
